<template>
    <div>
        <van-search v-model="searchval" show-action placeholder="华为" @search="onSearch" @click="ss">
            <template #action>
                <div @click="onClickButton">搜索</div>
            </template>
        </van-search>
        <div v-for="item in qsearchApiData"><van-cell :title="item.goods_name" size="large" @click="lr" /></div>
    </div>
</template>

<script setup>
import { ref, watch } from 'vue';
import { qsearchApi } from '@/api/api';
const qsearchApiData = ref([])
const searchval = ref([])
const ss = () => {
    searchval.value = '华为'
}
const title = ref([])
watch(searchval, (val) => {
    console.log(val);
    qsearchApi(val).then(res => {
        console.log(res);
        qsearchApiData.value = res.data.message
        title.value = res.data.message
    })
})

const lr = () => {
    console.log('风帆（sail） Q1 充电宝，适用苹果华为小米移动充电 汽车应急启动电源 电瓶救援搭电宝 多功能移动电源');
 searchval.value = '风帆（sail） Q1 充电宝，适用苹果华为小米移动充电 汽车应急启动电源 电瓶救援搭电宝 多功能移动电源'
}
</script>

<style lang="scss" scoped></style>